package com.sc.nft.config;

import com.sc.nft.config.sand.CertUtil;
import com.sc.nft.config.sand.SDKConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class SandPaySdkInitConfig {

    @Bean
    public void sandInitialized() {

        // 加载证书
        try {
            //加载配置文件
            SDKConfig.getConfig().loadPropertiesFromSrc();
            //加载证书
            CertUtil.init(SDKConfig.getConfig().getSandCertPath(), SDKConfig.getConfig().getSignCertPath(), SDKConfig.getConfig().getSignCertPwd());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
